from django.urls import path, register_converter

from apps.users.views import UsernameCountView, RegisterView, LogoutView, LoginView, UserInfoView, SaveEmailView, \
    EmailVerifyView, AddressCreateView, AddressView, AddressUpdata, DefaultAddress, UpdateTitleAddress, ChangePassword
from utils.converters import UsernameConverter

register_converter(UsernameConverter, 'uname')

urlpatterns = [
    path('usernames/<uname:username>/count/', UsernameCountView.as_view()),
    path('register/', RegisterView.as_view()),
    path('login/', LoginView.as_view()),
    path('logout/', LogoutView.as_view()),
    path('info/', UserInfoView.as_view()),
    path('emails/', SaveEmailView.as_view()),
    path('emails/verification/', EmailVerifyView.as_view()),
    path('addresses/create/', AddressCreateView.as_view()),
    path('addresses/', AddressView.as_view()),
    path('addresses/<address_id>/', AddressUpdata.as_view()),
    path('addresses/<address_id>/', AddressUpdata.as_view()),
    path('addresses/<address_id>/default/', DefaultAddress.as_view()),
    path('addresses/<address_id>/title/', UpdateTitleAddress.as_view()),
    path('password/', ChangePassword.as_view()),
]
